package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;
public class test {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        String st="exit";
         while (true){
             FileOutputStream fil=new FileOutputStream("note.txt",true);
             System.out.println("请输入一行字符串");
             String str=scan.nextLine();
             if ("exit".equalsIgnoreCase(str)){//忽略大小写判断字符串是否相同
                 System.out.println("退出");
                 break;
             }
             fil.write(str.getBytes(StandardCharsets.UTF_8));
             System.out.println("写入完毕");
             fil.close();
        }
    }
}
